public class Test_MySingleLinkedList {


    //相交链表测试
    public static void func(MySingleLinkedList.ListNode headA, MySingleLinkedList.ListNode headB){
        headB.next.next = headA.next.next.next;
    }
    public static void main2(String[] args) {
        MySingleLinkedList myLinkedList = new MySingleLinkedList();
        MySingleLinkedList myLinkedList1 = new MySingleLinkedList();
        myLinkedList1.addLast(12);
        myLinkedList1.addLast(23);
        myLinkedList1.addLast(34);
        myLinkedList1.addLast(45);
        myLinkedList1.addLast(56);

        MySingleLinkedList myLinkedList2 = new MySingleLinkedList();
        myLinkedList2.addLast(20);
        myLinkedList2.addLast(26);


        func(myLinkedList1.head, myLinkedList2.head);
        myLinkedList2.display();

        MySingleLinkedList.ListNode ret = myLinkedList.getIntersectionNode(myLinkedList1.head, myLinkedList2.head);
        System.out.println(ret.val);

    }

    public static void main1(String[] args) {
        MySingleLinkedList myLinkedList = new MySingleLinkedList();
        myLinkedList.addLast(12);
        myLinkedList.addLast(23);
        myLinkedList.addLast(34);
        myLinkedList.addLast(45);
        myLinkedList.addLast(56);

        myLinkedList.display();

        System.out.println("--------");

        int ret = myLinkedList.kthToLast(7);
        System.out.println(ret);


//        MyLinkedList.ListNode ret = myLinkedList.middleNode();
//        System.out.println(ret.val);
//
//        myLinkedList.reverseList();
//        myLinkedList.display();

//        System.out.println("--------");
//
//        myLinkedList.removeAllKey(56);
//
//        myLinkedList.display();
//
//        System.out.println("--------");
//
//        myLinkedList.clear();
//
//        myLinkedList.display();


    }


}
